apiVersion: batch/v1
kind: Job
metadata:
  name: hyperpitrix-release-app-job
  namespace: openpitrix-system
  labels:
    app: hyperpitrix
    job: hyperpitrix-release-app
    version: {{ op_version }}
spec:
  backoffLimit: 100
  completions: 1
  parallelism: 1
  template:
    metadata:
      labels:
        app: hyperpitrix
        job: hyperpitrix-release-app
        version: {{ op_version }}
      name: hyperpitrix-release-app-job
    spec:
      initContainers:
      - name: wait-app-manager
        image: {{ busybox_repo }}:{{ busybox_tag }}
        imagePullPolicy: IfNotPresent
        command: ['sh', '-c', 'until nc -z hyperpitrix.openpitrix-system.svc 9102; do echo "waiting for app-manager"; sleep 2; done;']
      - name: wait-attachment-manager
        image: {{ busybox_repo }}:{{ busybox_tag }}
        imagePullPolicy: IfNotPresent
        command: ['sh', '-c', 'until nc -z hyperpitrix.openpitrix-system.svc 9122; do echo "waiting for attachment-manager"; sleep 2; done;']
      containers:
      - command: ["release-app","-path","/data/helm-pkg/"]
        name: hyperpitrix-release-app-job
        imagePullPolicy: IfNotPresent
        image: {{ release_app_repo }}:{{ release_app_tag }}
      restartPolicy: OnFailure
      dnsPolicy: ClusterFirst
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
